package club.zhcs.sbc.controller;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import club.zhcs.sbc.biz.CamundaService;
import club.zhcs.sbc.mapper.UserMapper;
import club.zhcs.sbc.model.User;
import club.zhcs.sbc.rest.ApiResponse;

@RestController
public class HomeController {

	@Autowired
	UserMapper userMapper;

	@Autowired
	CamundaService camundaService;

	Logger logger = Logger.getLogger(getClass());

	@RequestMapping("/")
	public String hello() {
		logger.debug("test log");
		return "Hello Sbc";
	}

	@RequestMapping("/mapper")
	public List<User> mapper() {
		return userMapper.selectAll();
	}

	@RequestMapping("/start")
	private String start() {
		camundaService.start();
		return "Success!";
	}

	@RequestMapping("/enum")
	public ApiResponse enumTest() {
		return ApiResponse.success(1);
	}

}
